// IMPORTANT: Add this configuration to your modules.config
// These settings are to ensure you include the reference information within the output file names, to prevent overwriting!
// `meta.id_index` is created and used within the workflow. You must reuse this meta field if you wish to customise the file naming scheme.

process {

    publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

    withName: '.*FASTQ_ALIGN_BWAALN:BWA_ALN' {
        ext.prefix = { "${meta.id}_${meta.id_index}" }
    }

    withName: '.*FASTQ_ALIGN_BWAALN:BWA_SAMSE' {
        ext.prefix = { "${meta.id}_${meta.id_index}" }
    }

    withName: '.*FASTQ_ALIGN_BWAALN:BWA_SAMPE' {
        ext.prefix = { "${meta.id}_${meta.id_index}" }
    }

    withName: '.*FASTQ_ALIGN_BWAALN:SAMTOOLS_INDEX' {
        ext.prefix = { "${meta.id}_${meta.id_index}" }
    }


}
